Hi all!
Say I have a module, A, with linksets to many targets. But two of these, B, and C, must not be simultaneous. That is, an object may not have outgoing links to both B and C modules.
Is there any way to have a trigger on the creation of a link? Then I could warn the user and/or not allow the creation of the link itself.
My poor solution so far (I use DOORS 8.1, I don't know if they improved triggers in version 9) is just warning when the user clicks on an object with links to B and C:
trigger("doubleLinkTrigger", module->"L1SRD"->object->all, pre, sync, 10, "#include <MEA/triggers/triggerdxl.dxl>")
Thanks!!
albertosegovia@work - Tue Aug 18 04:05:03 EDT 2009 |
|
Re: Trigger on link creation? SystemAdmin - Tue Aug 18 08:14:17 EDT 2009
There is no trigger action associated with link creation. So, not possible.
|
|
Re: Trigger on link creation? llandale - Tue Aug 18 09:04:02 EDT 2009
I wonder how your trigger actually works, since it fires BEFORE the object is actually synced. Maybe it warns when you are clicking AWAY from an object with double links. Perhaps make it a 'post' sync trigger, and the code can use Object o = object(current trigger).
You could have a pre-close module trigger that checks for share or edit, and if so scans all the objects looking for double links, and warning the user if so.
Too bad there is no pre-save-module trigger, or like you said a pre-create-link trigger. Or a database login/logout trigger.
|
|
Re: Trigger on link creation? roybond - Wed Aug 19 04:04:49 EDT 2009
It is possible to have a trigger that fires as a result of a Link being created and/or removed, but the implementation relies upon the view containing a Layout DXL column.
You require an attribute which holds the current number of links from the current object.
You then require the layout DXL to count the current number of links from the current object.
The layout DXL then compares the current count the count stored in the object attribute.
If the number is different, then the attribute is overwritten.
At this point you can then either use a post modify attribute trigger, or simply extend the layout DXL to take the appropriate actions.
Best of luck.
Roy
roy.bond@baesystems.com
|
|
Re: Trigger on link creation? llandale - Wed Aug 19 13:27:49 EDT 2009 roybond - Wed Aug 19 04:04:49 EDT 2009
It is possible to have a trigger that fires as a result of a Link being created and/or removed, but the implementation relies upon the view containing a Layout DXL column.
You require an attribute which holds the current number of links from the current object.
You then require the layout DXL to count the current number of links from the current object.
The layout DXL then compares the current count the count stored in the object attribute.
If the number is different, then the attribute is overwritten.
At this point you can then either use a post modify attribute trigger, or simply extend the layout DXL to take the appropriate actions.
Best of luck.
Roy
roy.bond@baesystems.com
Very clever, but it depends on the user using a particular view when creating links.
Was thinking about AttrDXL, but you get that to fire by setting its value blank, which prevents it from remembering its own previous value and dealing with the links if it changes.
Perhaps your idea of a static attribute, and a pre-object-sync trigger looks at all displayed objects counting out links, and if there's a descrepency deal with it. It won't fire if the user creates a link and then saves and closes, but it will fire when he selects a new object.
|
|
Re: Trigger on link creation? roybond - Thu Aug 20 04:07:10 EDT 2009 llandale - Wed Aug 19 13:27:49 EDT 2009
Very clever, but it depends on the user using a particular view when creating links.
Was thinking about AttrDXL, but you get that to fire by setting its value blank, which prevents it from remembering its own previous value and dealing with the links if it changes.
Perhaps your idea of a static attribute, and a pre-object-sync trigger looks at all displayed objects counting out links, and if there's a descrepency deal with it. It won't fire if the user creates a link and then saves and closes, but it will fire when he selects a new object.
Louie, you are right, but I did say that the implementation relies upon the view containing a Layout DXL column.
In our case, I have added a Layout DXL column into the default view of most Formal Modules, which only displays the Object ID against the Objects which have been tagged as requirements (or other such Object Data Types), else it remains clear.
I have simply extended this Layout DXL to perform this additional task, where required.
Since the 'trigger' is dealing with out-going links being added to the current Object, the Object is always in view and the Layout DXL is being refreshed, and so the implementation works very well.
Note : I actually do not have a Trigger hanging off the update of the count attribute, I have simply extended the Layout DXL to perform all the actions I need based on the comparison of the current count link to the previously stored value.
Roy.
|
|
Re: Trigger on link creation? Ben_Sharples - Mon Aug 24 11:22:03 EDT 2009
another potential option you could look at is:
combine the two link modules for links from A to B and A to C, into a singular link module that contains a link attribute with the option to B or C.
This way the link attribute can only be B or C.
In order to filter against either you would need to bring the link attribute out in a layout DXL column and filter on columns containing B and / or C
|
|